import React from 'react'
import { connect } from 'react-redux'
import browserCookie from 'browser-cookies'
import CardList from '@/components/CardList'
import { getPreyList } from '@/redux/Prey.redux'

@connect(
    state => state.prey,
    { getPreyList }
)
class PreyList extends React.Component{

    componentDidMount() {
        const type = browserCookie.get('type')
        this.props.getPreyList(type === 'genius' ? 'boss' : 'genius')
    }

    render(){
        return (
            <CardList data={this.props.preyList} />
        )
    }
}

export default PreyList